package errgo

import (
	"fmt"
	"strings"
)

type Error struct {
	errStack []string
}

func (e *Error) Error() string {
	return strings.Join(e.errStack, "\n")
}

func New(err string, args ...interface{}) *Error {
	if args == nil || len(args) == 0 {
		return &Error{errStack: []string{err}}
	}
	return &Error{errStack: []string{fmt.Sprintf(err, args...)}}
}
